fix(review): honor trusted advisory dispositions - #94
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR Review🚫 Merge blocked: 3 serious issue(s) found in high-risk files ⚖️ Codex Review Arbitration🚫 block: The current blockers remain valid against the cumulative diff. First, 🚫 Blocking IssuesThese issues must be fixed before this PR can be merged: 1. 🟠 [HIGH] Logic in
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 482595b918
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94dea8e159
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| trusted_suppressed_blockers = [ | ||
| finding | ||
| for finding in decision["non_blocking_findings"] | ||
| if finding.get("trusted_advisory_suppressed") is True | ||
| and finding.get("would_block_without_trusted_advisory") is True | ||
| ] |
There was a problem hiding this comment.
Clear advisory history even when Codex omits the repeat
When the head is unchanged and the trusted advisory context makes the primary reviewer omit the resolved finding instead of re-emitting it as a suppressed non-blocker, this list is empty because it only inspects current non_blocking_findings. remaining_history_after_trusted_advisory_suppression then keeps the prior active history, so the run still blocks/arbitrates without the advisory context even though the advisory has been resolved; advisory-covered history needs to be cleared independently of whether Codex repeats the finding.
Useful? React with 👍 / 👎.
| suppressed_identities = { | ||
| _history_finding_identity(finding) | ||
| for finding in suppressed_findings |
There was a problem hiding this comment.
Key history clearance on advisory identity
When a trusted advisory suppresses a repeated finding but Codex rephrases the description, this set no longer matches the stored active history because _history_finding_identity includes the sanitized description. Fresh evidence is that the new exemption key uses current finding text even after _finding_matches_trusted_advisory has already proved the exact advisory via provenance/thread, so same-advisory repeats with wording drift still fall through to active-history blocking/arbitration.
Useful? React with 👍 / 👎.
| severity in BLOCK_SEVERITIES | ||
| and file_risk == "high" | ||
| and file_path in changed_paths # only block on actually changed files | ||
| and has_blocking_evidence |
There was a problem hiding this comment.
Validate the finding line before blocking
For a high/critical finding in a changed file, has_blocking_evidence only proves that the separate caller/boundary evidence line exists; the reported finding["line"] is never checked to be present or part of the patch. If Codex returns a valid current_caller but points the bug at an unchanged or nonexistent line in the changed file, this still blocks and can drive remediation against a hallucinated location, contrary to the exact changed path/line gate added in the prompt.
Useful? React with 👍 / 👎.
|
|
||
| def parse_prior_contract_conflict(body: str) -> bool: | ||
| """Preserve a trusted conflict marker; malformed duplicates fail closed.""" | ||
| marker_count = (body or "").count(CONTRACT_CONFLICT_MARKER_PREFIX) |
There was a problem hiding this comment.
Anchor contract-conflict markers before parsing
This counts the marker prefix anywhere in the previous bot comment, but finding descriptions and suggestions are rendered back into that same comment verbatim. If a reviewer finding quotes this marker-like text from the diff, the next run sees multiple prefixes and treats it as a trusted contract conflict even when the real machine marker is false, which can leave the PR blocked for contract arbitration based only on displayed finding text; parse only the dedicated marker line instead.
Useful? React with 👍 / 👎.
Summary
Validation
python3 -m unittest tests.test_run_codex_pr_review: 62 passedpython3 -m pytest tests ops/quant-monitor/tests -q: 660 passed, 1 skipped, 50 subtests passedpython3 -m ruff check .python3 -m compileall -q scripts service tests opsactionlintgit diff --checkBoundaries